import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:robotcontrol/entity/common_item.dart';
import 'package:robotcontrol/http/http_manager.dart';
import 'package:robotcontrol/http/url.dart';
import 'package:robotcontrol/page/discovery/follow_item_widget.dart';
class FolloPage extends StatefulWidget{
  @override
  _FolloPagState createState() =>_FolloPagState();
}
class _FolloPagState extends State<FolloPage> with AutomaticKeepAliveClientMixin{
  Issue data;
  @override
  Widget build(BuildContext context) {
    super.build(context);
    return ListView.separated(
        separatorBuilder: (context,index) => Divider(height: 0.5,),
        itemCount: data == null ? 0:data.itemList.length,
        itemBuilder: (context,index){
      return FollowItemWidget(item:data.itemList[index]);
    });
  }

  @override
  // TODO: implement wantKeepAlive
  bool get wantKeepAlive => true;

  @override
  void initState() {
    super.initState();
    _loadData();
  }

  void _loadData() async {
    HttpManager.getData(Url.followUrl, success: (json) {
      data = Issue.fromJson(json);
      setState(() {
      });
    });
  }
}
